package com.sxj.corejava.code08_常用类.泛型;

/**
 * @author 石小俊
 * @date 2025年02月18日
 */
public class Test01_泛型类 {
    public static void main(String[] args) {
        Student student = new Student();
        student.setNo("wbs001");
        student.setNo(1);
        student.setNo(true);
        student.setNo(3.14);

        Stu<Integer> stu = new Stu<>();
        stu.setNo(1);

        Stu<String> stu2 = new Stu<>();
        stu2.setNo("wbs");

    }
}

class Stu<T> {
    private T no;
    private String name;

    public T getNo() {
        return no;
    }

    public void setNo(T no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

class Student {
    private Object no;
    private String name;

    public Object getNo() {
        return no;
    }

    public void setNo(Object no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
